package com.tcc.fastline.Helpers;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import com.google.gson.GsonBuilder;

public class DateTime {
	private static SimpleDateFormat date = new SimpleDateFormat("dd/MM/yyyy");
	private static SimpleDateFormat dateTime = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
	private static SimpleDateFormat dateTimeServidor = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
	
	public static Date convertDate(String data) {
		try {
			return date.parse(data);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static Date convertDateTime(String data) {
		try {
			return dateTime.parse(data);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static Date convertDateTimeServidor(String data) {
		try {
			return dateTimeServidor.parse(data);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static String formatDate(Date data) {
		return date.format(data);
	}

	public static String formatDateTime(Date data) {
		return dateTime.format(data);
	}
	
	public static String formatDateTimeServidor(Date data) {
		return dateTimeServidor.format(data);
	}
}
